package ua.com.globallogic.training.generics;

import org.jetbrains.annotations.NotNull;

public class Fruit implements Comparable<Fruit>{

    private String name;
    private double weight;

    public Fruit(String newName, double newWeight) {
        name = newName;
        weight = newWeight;
    }

    public String getName() {
        return name;
    }

    @Override
    public int compareTo(@NotNull Fruit fruitToCompare) {
        if (weight > fruitToCompare.weight) {
            return 1;
        } else if (weight < fruitToCompare.weight) {
            return -1;
        }
        return 0;
    }
}
